#
#  OSPFv2 floodig test suite Makefile
#

#----------------------------------------------------------- SETUP

VERSION = 0.2.1
TOPDIR = ../../../../../../..
include $(TOPDIR)/Makefile.common

JAVAC = javac -classpath $(SSFNET_TEST_CLASSPATH)
JAVA  = java  -classpath $(SSFNET_TEST_CLASSPATH)

# This is for the cygwin environment which has trouble with the mix of
# slashes and backslashes... Take care, that the classpath is set correctly!
ifeq ($(OSTYPE), cygwin)
JAVAC = javac
JAVA  = java
endif

SHARED=../shared
VERDICT=$(SHARED)/verdict.pl
REPORT=report.log
COMPLETE=complete.log

#TESTS=01_multi_access_adj 02_dd_mtu_set \
#03_dd_mtu_match 04_negotiation 05_self_orig_lsa \
#06_old_lsa 07_nbr_state 08_dd_retransmit 09_seq_num_mismatch \
#10_flooding 11_flooding_ase 12_ls_ack 13_lsa_retrans 14_flooding_guarantee \
#15_lsa_multicast 16_retrans_unicast 17_lsa_request_retr 18_bad_ls_req \
#19_maxage_flood 20_lsa_refresh 21_remove_from_retr

TESTS=02_dd_mtu_set 03_dd_mtu_match 04_negotiation\
05_self_orig_lsa 06_old_lsa 07_nbr_state 08_dd_retransmit\
09_seq_num_mismatch 10_flooding 16_retrans_unicast\
17_lsa_request_retr 18_bad_ls_req 19_maxage_flood 20_lsa_refresh \
21_remove_from_retr
#----------------------------------------------------------- MAKE tests
tests:
	@list='$(TESTS)'; for testcase in $$list; do \
	(cd $$testcase && $(MAKE))\
	done;
	@$(VERDICT) flood.ospf.v4.ip $(REPORT) $(TESTS) > $(REPORT)
	@cat $(REPORT)

#----------------------------------------------------------- MAKE report
report:
	@echo "######## Complete Test Report for flood.ospf.v4.ip ########" > $(COMPLETE)
	@list='$(TESTS)'; for testcase in $$list; do \
	(cat $$testcase/report.log >> $(COMPLETE))\
	done;
	@cat $(REPORT) >> $(COMPLETE)
	
#----------------------------------------------------------- MAKE clean
clean:
	rm -f *.log *.tcpdump *.dump *.bak *~
	@list='$(TESTS)'; for testcase in $$list; do \
	(cd $$testcase && $(MAKE) clean)\
	done;
